
<template>
  <div class="home-hot">
    <div class="home-panel">
      <div class="container">
        <div class="head">
          <h3>人气推荐<small>人气爆款 不容错过</small></h3>
        </div>
        <div style="position: relative; height: 426px">
          <ul class="goods-list">
            <li v-for="(item, index) in arr2" :key="index">
              <a
                aria-current="page"
                href="#/"
                class="router-link-active router-link-exact-active"
                ><img :src="item.picture" alt="" />
                <p class="name ellipsis">
                  {{ item.alt }}
                </p>
                <p class="price">{{ item.price }}</p>
              </a>
            </li>
          </ul>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import axios from "axios";
export default {
  data() {
    return {
      arr2: [],
    };
  },
  mounted() {
    var _this = this
    axios({
            url: "http://pcapi-xiaotuxian-front-devtest.itheima.net/home/hot",
            method: "get",
          }).then(function (res) {
            if (res.data.msg == "操作成功") {
              _this.arr2 = res.data.result;
              console.log(_this.arr2);
            }
          });
  },

    
  
};
</script >

<style scoped>
.home-panel .head {
  padding: 40px 0;
  display: flex;
  align-items: flex-end;
}
.home-panel .head h3 {
  flex: 1;
  font-size: 32px;
  font-weight: 400;
  margin-left: 6px;
  height: 35px;
  line-height: 35px;
}
.home-panel .head h3 small {
  font-size: 16px;
  color: #999;
  margin-left: 20px;
}
.goods-list {
  display: flex;
  justify-content: space-between;
  height: 406px;
}
.goods-list li {
  width: 306px;
  height: 406px;
  transition: all 0.5s;
}

.goods-list li img {
  width: 306px;
  height: 306px;
}
.goods-list li p {
  font-size: 22px;
  padding: 12px 30px 0 30px;
  text-align: center;
}
.goods-list li .price {
  color: #cf4444;
}
.goods-list {
  display: flex;
  justify-content: space-between;
  height: 426px;
}
.goods-list li {
  width: 306px;
  height: 406px;
  transition: all 0.5s;
}
.goods-list li:hover {
  transform: translate3d(0, -3px, 0);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
}
.goods-list li img {
  width: 306px;
  height: 306px;
}
.goods-list li p {
  font-size: 22px;
  padding-top: 12px;
  text-align: center;
  font-size: 22px;
  padding: 12px 30px 0 30px;
  text-align: center;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}
.goods-list li .desc {
  color: #cf4444;
  font-size: 22px;
}
</style>

